package cn.stylefeng.guns.modular.business.frequency.transport.service;

import cn.stylefeng.guns.core.pojo.page.PageResult;
import cn.stylefeng.guns.modular.business.frequency.orderpick.model.param.PickCarExcludeDTO;
import cn.stylefeng.guns.modular.business.frequency.ordersub.model.param.OrderDTO;
import cn.stylefeng.guns.modular.business.frequency.ordersub.model.result.PkgOrderSubBase;
import cn.stylefeng.guns.modular.business.frequency.transport.entity.Transport;
import cn.stylefeng.guns.modular.business.frequency.transport.model.param.TransportDTO;
import cn.stylefeng.guns.modular.business.frequency.transport.model.param.TransportParam;
import cn.stylefeng.guns.modular.business.frequency.transport.model.result.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;
import java.util.Map;

/**
 * 运单 服务类
 *
 * @author yujie
 * @date 2023/05/09 17:15
 */
public interface TransportService extends IService<Transport> {

    /**
     * 分页查询运单
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    PageResult<Transport> page(TransportParam transportParam);

    /**
     * 查询所有运单
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    List<Transport> list(TransportParam transportParam);

    /**
     * 添加运单
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    void add(TransportParam transportParam);

    /**
     * 删除运单
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    void delete(TransportParam transportParam);

    /**
     * 编辑运单
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    void edit(TransportParam transportParam);

    /**
     * 查看详情运单
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    Transport detail(TransportParam transportParam);

    /**
     * 修改状态（字典 0正常 1停用 2删除）
     *
     * @author yujie
     * @date 2023/05/09 17:15
     */
    void changeStatus(TransportParam transportParam);


    /** 待发运订单分页列表 */
    Page getWaitTransportOrderList(OrderDTO orderDTO);

    Map<String, List<String>> getStartCodeAndDestinationCode(OrderDTO orderDTO);

    /** 已发运列表   发运记录 */
    Page<TransportPageVO> getFinishTransportList(TransportDTO transportDTO);

    /** 签收装车运单列表 */
    Page<TransportPageVO> getSignedTransportList(TransportDTO transportDTO);


    /** 发运单详情 */
    PkgTransport getTransportDetail(String id, Integer scene, TransportDTO transportDTO);

    /** 运单详情（按订单展开）  */
    List<TransportExpandVO> getTransportExpandDetail(String id, TransportDTO transportDTO);

    TransportVO getTransportVODetail(TransportDTO transportDTO);

    List<PkgTransportOrderDetail> getTransportOrderDetail(OrderDTO orderDTO);

    Page<PkgOrderSubBase> getWaitTransportExcludeList(PickCarExcludeDTO pickCarExcludeDTO);

    /**  校验发运参数 */
    boolean checkTransportAdd(TransportVO transportVO, StringBuilder errorMsg);

    /**  批量指派发运  */
    void transport(TransportVO transportVO);

    boolean checkTransportUpdate(TransportVO transportVO, StringBuilder errorMsg);

    void updateTran(TransportVO transportVO);

    boolean checkTransportCancel(String id, StringBuilder errorMsg);

    void cancel(String id);

    /** 签收装车 参数校验 */
    boolean checkReservedTransport(TransportVO transportVO, StringBuilder errorMsg);

    /** 签收装车 */
    void reservedTransport(TransportVO transportVO);

    List<PkgTransport> getOrderTransportDetail(String orderId);

    boolean checkMultiDriverAssign(Transport transport, StringBuilder errorMsg);

    void assignDriver(Transport transport);

    List getTransportOrderExport(String levelId);

    PkgTransportLevel getTransportLevelDetail(String levelId);

    void returnTransport(Long id);

    List<TransportExportVO> getFinishTransportList2(TransportDTO transportDTO);
}